package com.naiterui.ehp.bs.b2c.product.repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bs.b2c.product.entity.Medicine;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * <pre>
 * 药品持久层
 * </pre>
 *
 * @author fangguanhong
 * @date 2019/6/14 下午9:06
 * @since 1.0.0
 */
@Repository
public interface IMedicineRepository extends BaseJpaRepository<Medicine, Long> {

    /**
     * 根据id  批量获取药品
     *
     * @param pids
     *
     * @return
     */
    List<Medicine> findAllByProductIdIn(Set<Long> pids);

    Medicine findByProductId(Long productId);

    List<Medicine> findByProductIdIn(Collection<Long> pids);

    List<Medicine> findByCreatedAtBetween(Date startDate, Date endDate);
}
